import request from '@/utils/request.js';
import { setting } from '@/config/setting';
const { tokenName } = setting;
export const login = async (data) => {
  return request({
    url: '/login',
    method: 'post',
    data,
  });
};

export const Verification = async (data) => {
  return request({
    url: '/Verification',
    method: 'post',
    data,
  });
};

// 获取验证码
export const getCodeImg= async () => {
  return request({
    url: '/captchaImage',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}

// 获取用户详细信息
export const getInfo = async (data) => {
  return request({
    url: '/getInfo',
    method: 'get'
  })
}


//测试获取用户详细信息
export const getUserInfo = (accessToken) => {
  return request({
    url: '/userInfo',
    method: 'get',
    data: {
      [tokenName]: accessToken,
    },
  });
};

export const logout = () => {
  return request({
    url: '/logout',
    method: 'post',
  });
};

export const register = async () => {
  return request({
    url: '/register',
    method: 'post',
  });
};
